const path = require('path');
// 跟目录
var BASE_PATH = path.resolve(__dirname, '/');
var ROOT_PATH = path.resolve(__dirname, '..');
var APP_PATH = path.resolve(ROOT_PATH, 'app');
var NODE_MODULES_PATH = path.resolve(ROOT_PATH, 'node_modules');

exports.getEntries = (conf) => {
  var comEntries = [];
  // 开发模式下 热更新模块
  if (conf.env === 'development') {
    // webpackDevServer inline模式启动依赖
    comEntries.push('webpack/hot/dev-server');
    // webpackDevServer api启动依赖 或者在html中使用 <script src="http://localhost:<<port>>/webpack-dev-server.js"></script>
    comEntries.push(`webpack-dev-server/client?http://${conf.dev_hot_server_host}:${conf.dev_hot_server_port}`);
  }

  let c = [
    ...comEntries,
    // "babel-polyfill",
    // "es6-proxy-polyfill",
  ];
  return {
    main: [
      ...c,
      `${APP_PATH}/pages/home/index.jsx`,
    ],
  };
};

exports.BASE_PATH = BASE_PATH;
exports.ROOT_PATH = ROOT_PATH;
exports.APP_PATH = APP_PATH;
exports.NODE_MODULES_PATH = NODE_MODULES_PATH;
